
template<typename T,typename Mgr>
class ComponentHandler
{
public:
    ComponentHandler(Entity* ower)
    {
        ptr = Mgr::getSingleton().alloc(ower);
    }

    ~ComponentHandler()
    {
        Mgr::getSingleton().release(ptr);
        ptr = null;
    }

    T* operator->() 
    {
        return ptr;
    }

    T* operator->() const 
    {
        return ptr;
    }

private:
    T* ptr;
};